package com.cdks.wuxiu.api.service.mysql;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdks.wuxiu.api.component.constant.Constant;
import com.cdks.wuxiu.api.mapper.CommentReplyInfoMapper;
import com.cdks.wuxiu.api.model.dto.CommentReplyInfoDTO;
import com.cdks.wuxiu.entity.mysql.CommentReplyInfo;
import java.util.List;

import org.springframework.stereotype.Service;

/**
 * 评论回复信息 服务实现类
 */
@Service
public class CommentReplyInfoServiceImpl extends ServiceImpl<CommentReplyInfoMapper, CommentReplyInfo> implements CommentReplyInfoService {

    @Override
    public List<CommentReplyInfoDTO> getList(long userId, long topicId, int type, int page) {
        List<CommentReplyInfoDTO> replyList  = null;
        int pageSize  = 3;

        switch (type)
        {
            case Constant.REPLY_LIST_ALL:
            {
                replyList  = baseMapper.getListAll(userId, topicId, page * pageSize, pageSize);
                break;
            }

            case Constant.REPLY_LIST_MINE:
            {
                replyList  = baseMapper.getListMine(userId, topicId, page * pageSize, pageSize);
                break;
            }

            default:
            {
                break;
            }
        }

        return replyList;
    }

    @Override
    public int addReplyCount(long replyId) {
        return baseMapper.addReplyCount(replyId);
    }
}
